home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Applications / mint / bin / crtype < prev    next >
Text File  |  1994-04-23  |  424b  |  21 lines

  1. #!/usr/bin/perl
  2. # usage: perl crtype <file...>
  3. # tell what kind of end of line convention is used.
  4.  
  5. while ($file = shift(@ARGV)) {
  6.     last unless open(F, "<$file");
  7.     binmode(F);
  8.     while (1) {
  9.     $type = "Unknown";
  10.     last unless read(F, $buf, 1024);
  11.     $type = "DOS";
  12.     last if $buf =~ "\r\n";
  13.     $type = "Mac";
  14.     last if $buf =~ "\r";
  15.     $type = "UNIX";
  16.     last if $buf =~ "\n";
  17.     }
  18.     print "'$file': $type\n";
  19.     close(F);
  20. }
  21.